package com.augurit.gzcgwsp.wfex.common.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.augurit.gzcgwsp.commonex.util.lang.DateUtilsEX;
import com.augurit.wf.common.dao.OaDocCodeDao;
import com.augurit.wf.common.entity.OaDocCode;

@Repository
public class OaDocCodeDaoEX extends OaDocCodeDao{
	
	public List<OaDocCode> get(String templateCode, String word){
		List<OaDocCode> list = null;
		if(templateCode != null && templateCode.trim().length()>0 && word != null && word.trim().length()>0){
			String year = getCurrentYear();
//			String hql = "from OaDocCode ps where ps.template=? and ps.word=?";
			String hql = "from OaDocCode ps where ps.word=?";
//			list = this.find(hql, templateCode, word);
			list = this.find(hql, word);
		}
		return list;
	}
	
	
    public List<OaDocCode> getOaDocCode(String templateCode,String fileCode, Long ywId) {
        List<OaDocCode> list = null;
        String hql = "from OaDocCode ps where ps.templateCode='"+templateCode+"'"+" and ps.word='"+fileCode+"'"+" and ps.ywId='"+ywId+"' and ps.year='"+DateUtilsEX.getCurYear()+"'";
         list = this.find(hql);
        return list;
    }
}
